from django.conf.urls import url,include
from . import views

###########版本一
urlpatterns = [
    url(r'^idcs/$',views.idc_list),
    url(r'^idcs/(?P<pk>[0-9]+)/$',views.idc_detail),
]

###########版本二
from rest_framework.urlpatterns import format_suffix_patterns
urlpatterns = [
    url(r'^$',views.api_root),
    url(r'^idcsv2/$',views.idc_list_v2,name='idc-list'),
    url(r'^idcsv2/(?P<pk>[0-9]+)/$',views.idc_detail_v2,name='idc-detail'),
]
urlpatterns = format_suffix_patterns(urlpatterns)

###########版本三
from rest_framework.urlpatterns import format_suffix_patterns
urlpatterns = [
    url(r'^$',views.api_root),
    url(r'^idcsv3/$',views.IdcList.as_view(),name='idc-list'),
    url(r'^idcsv3/(?P<pk>[0-9]+)/$',views.IdcDetail.as_view(),name='idc-detail'),
]
urlpatterns = format_suffix_patterns(urlpatterns)

###########版本四
from rest_framework.urlpatterns import format_suffix_patterns
urlpatterns = [
    url(r'^$',views.api_root),
    url(r'^idcsv4/$',views.IdcList_v4.as_view(),name='idc-list'),
    url(r'^idcsv4/(?P<pk>[0-9]+)/$',views.IdcDetail_v4.as_view(),name='idc-detail'),
]
urlpatterns = format_suffix_patterns(urlpatterns)

###########版本五
from rest_framework.urlpatterns import format_suffix_patterns
urlpatterns = [
    url(r'^$',views.api_root),
    url(r'^idcsv5/$',views.IdcList_v5.as_view(),name='idc-list'),
    url(r'^idcsv5/(?P<pk>[0-9]+)/$',views.IdcDetail_v5.as_view(),name='idc-detail'),
]
urlpatterns = format_suffix_patterns(urlpatterns)

#####################版本六
idc_list = views.IDCViewSet.as_view({
    "get": "list",
    "post": "create"
})
idc_detail = views.IDCViewSet.as_view({
    "get": "retrieve",
    "put": "update",
    "delete": "destroy"
})

from rest_framework.urlpatterns import format_suffix_patterns
urlpatterns = [
    url(r'^$',views.api_root),
    url(r'^idcsv6/$',idc_list,name='idc-list'),
    url(r'^idcsv6/(?P<pk>[0-9]+)/$',idc_detail,name='idc-detail'),
]
urlpatterns = format_suffix_patterns(urlpatterns)

#####################版本七
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register("idcsv7",views.IdcViewSet_v7)
urlpatterns = [
    url(r'^',include(router.urls))
]
